
public class Widening {
	public static void main(String[] args) {

		//if any data type which is going to be assigned into new data type and new data type 
		//size is greater than old data type then this process is called widening. 

		/**
		 * widening is implicite and narrowing is explicit(forcibly ). 
		 * 
		 *  byte   1 
		 *  short  2 
		 *  int    4
		 *  long   8 
		 *  float  4 
		 *  double 8 
		 *  char   2 
		 *  boolean  1 bit 
		 * 
		 *  byte -->short-->int-->long-->float -->double
		 *  -------------------Widening-------------->
		 * <-----------------Narrowing-----------------
		 *  mentissa & exponent 
		 *  in float 
		 *  1 byte is for mentissa and 3 byte is for exponent 

		 *   -128-- 127 X 2 (50000 )
		 *   
		 *    203 
		 *      01011000
		 */


		byte b=20;
		short s=b; //widening 

		int x=203;
		byte y=(byte)x;  //narrowing
		System.out.println(y);
		long x1=20;
		float f=x1;
        Widening widening=new Widening();
      //  widening.ab(2.0f);
       double d =2.0;
       float fn=2.0f;
        
        widening.ab(9);
	}
	//var arg   -- variable argument
	 
	/**
	 * 1:- var arg  must be last parameter in method
	 * 12:- there can be only one var arg in a method
	 *  3:- var arg is an alernative of array  
	 * @param b
	 * @param y
	 */
	public void ab( int... b){
	    System.out.println("var arg ---");
		for (int i = 0; i < b.length; i++) {
			 System.out.println(b[i]);
		}
	}
	

	public void ab(byte b){
		System.out.println("inside byte method");
	}

	
	public void ab(short b){
		System.out.println("inside short method");
	}
	
	/*public void ab(int b){
		System.out.println("inside int method");
	}
	*/
	/*public void ab(double b){
		System.out.println("inside double method");
	}*/
	
/*	public void ab(float b){
		System.out.println("inside float method");
	}
*/
	public void ab(Short b){
		System.out.println("inside Short method");
	}
	
	public void ab(Byte b){
		System.out.println("inside Byte method");
	}

	public void ab(Integer b){
		System.out.println("inside Integer method");
	}

	public void ab(Float b){
		System.out.println("inside Float method");
	}



}
